package com.ingrid.javi.activities;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.ingrid.javi.R;
import com.ingrid.javi.R.id;
import com.ingrid.javi.R.layout;
import com.ingrid.javi.model.DAO;
import com.ingrid.javi.model.Movie;

public class DetailsActivity extends Activity {

	public static String EXTRA_SELECTED_ID = "extraSelectedId";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.movie_detail);
		long movieId = this.getIntent().getLongExtra(EXTRA_SELECTED_ID, -1);

		Movie movie = new DAO(this).getMovieById(movieId);
		this.showMovie(movie);
	}

	private void showMovie(Movie movie) {
		TextView tvTitulo = (TextView) this.findViewById(R.id.tvTitulo);
		TextView tvAno = (TextView) this.findViewById(R.id.tvAno);
		TextView tvSinopse = (TextView) this.findViewById(R.id.tvSinopse);
		TextView tvNota = (TextView) this.findViewById(R.id.tvNota);

		tvTitulo.setText(movie.getTitulo());
		tvAno.setText("Ano: " + movie.getAno());
		tvSinopse.setText("Sinopse: " + movie.getSinopse());
		tvNota.setText("Nota: " + movie.getNota());
	}

}
